import request from '@/utils/request'
export function getUserInfo (params) {
  return request({
    url: `/login/user/getUserInfo`,
    method: 'get',
    params
  })
}
// 获取用户详细信息
export function getInfo () {
  return request({
    url: `${window.scjConfig.uploadUrl}/user/getUserInfo`,
    method: 'get',
    params: {}
  })
}
// 登录
export function login (data) {
  //admin
  //#Bad9$9332VW
  console.log(data)
  return new Promise((resolve, reject) => {
    if (data.loginName == 'admin' && data.password == '8f6b2263ff2e35890be99abcd797f846')
    {
      resolve({
        code: "0",
        data: {
          loginToken: 'yvdaGIEjLRgAayGlcRHoEIaIlYsEdrZkLtxPuOVApDV',
          msg: "登录成功"
        },
      })
    }
  })
  // return request({
  //     url: `/api/external/plat/login`,
  //     method: 'post',
  //     data
  // })
}
// 带手机验证码的登录
export function login2 (data) {
  return request({
    url: '/external/plat/loginWithMobile',
    method: 'post',
    data
  })
}

export function sendMobileCode (params) {
  return request({
    url: '/external/plat/sendMobileCode',
    method: 'get',
    params
  })
}
export function modifyPwdByMobile (data) {
  return request({
    url: '/external/plat/modifyPwdByMobile',
    method: 'post',
    data
  })
}
// 验证图形验证码
export function validateCaptcha (params, Cookie) {
  return request({
    url: '/external/plat/validateCaptcha',
    method: 'post',
    headers: {
      "Jsessionid": `JSESSIONID=${Cookie}`
    },
    params,
    data: {}
  })
}
// 登录获取图片验证码
export function captcha (params = {}, Cookie) {
  return request({
    url: '/external/plat/captcha',
    method: 'get',
    headers: {
      "Jsessionid": `JSESSIONID=${Cookie}`
    },
    responseType: 'blob',
    params
  })
}
